/**
 * Desenvolvido pela Fábrica de Software do CESUPA.
 * Todos os direitos reservados.
 */
package br.cesupa.fabsoft.nomedoprojeto.system.application.facades;

import br.cesupa.fabsoft.nomedoprojeto.system.application.facades.facesmessages.FacesMessageFacade;
import br.cesupa.fabsoft.nomedoprojeto.system.application.beans.ApplicationStatusBean;
import java.util.Locale;
import javax.faces.context.FacesContext;

/**
 * Summarize common operations related to the view.
 *
 * @author Breno Leite
 */
public class ViewFacade {

    /**
     * Defines the {@link Locale} to be used in the view rendering.
     *
     * @param locale the {@link Locale} to be used
     */
    public void setViewLocale(final Locale locale) {
        FacesContext.getCurrentInstance().getViewRoot().setLocale(locale);
    }

    /**
     * @return the bean which controls the application status.
     * @see ApplicationStatusBean
     */
    public ApplicationStatusBean manageApplicationStatus() {
        return ApplicationStatusBean.getCurrentInstance();
    }

    /**
     * @return the facade which offer an interface for the messages used by the
     * Java Server Faces
     * @see FacesMessageFacade
     */
    public FacesMessageFacade manageFacesMessages() {
        return new FacesMessageFacade();
    }
}
